package data_structs;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class Gui extends JFrame {
	
	private JPanel jp;
	private JList list;
	private JTextField sequencepanel;
	
	private static String[] ids = {"000001", "000002", "000003", "000004"};
	private static String[] seqs = {"ACTTTGTGCAAAAA", "TTTTTTTTTTTTAAAAAAAAAAAAAAAAAAATTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", "GGGGGGGAA", "ACTGACTGACTGACTG"};
	
	
	public Gui() {
		super("Results");
//		setLayout(new FlowLayout());
		
		
		sequencepanel = new JTextField();
		sequencepanel.setEditable(false);
//		sequencepanel.setMinimumSize(new Dimension(200,200));
		list = new JList(ids);
		list.setVisibleRowCount(5);
		list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		
		list.addListSelectionListener(
				new ListSelectionListener() {
					public void valueChanged(ListSelectionEvent event) {
						
						sequencepanel.setText(seqs[list.getSelectedIndex()]);
						sequencepanel.selectAll();
//						switch(list.getSelectedIndex()) {
//						case(0):
//							sequencepanel.select(0, sequencepanel.getText().length());
//							break;
//						case(1):
//							sequencepanel.select(5, 10);
//							break;
//						default:
//							sequencepanel.select(2, 7);
//							break;
//						}
					}
					
				}
		);

		list.setSelectedIndex(0);
		add(new JScrollPane(list), BorderLayout.SOUTH);
		add(new JScrollPane(sequencepanel), BorderLayout.CENTER);
		
		
	}

}
